import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
public class Screen extends JFrame implements KeyListener{
  public Screen( String title )
  {
	  
	  addKeyListener((KeyListener)this);
      setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      setUndecorated(true);
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      setBounds(0,0,screenSize.width, screenSize.height);
  }

  public static void main( String[] args )
  {
	  Screen frame = new Screen("");
      frame.setVisible(true);
  }

@Override
public void keyPressed(KeyEvent e) {
	if(e.getKeyCode() == 27){
		this.setVisible(false);
	    setDefaultCloseOperation(EXIT_ON_CLOSE);

	}
	System.out.println(e.getKeyCode());
}

@Override
public void keyReleased(KeyEvent arg0) {
	// TODO Auto-generated method stub
	
}

@Override
public void keyTyped(KeyEvent arg0) {
	// TODO Auto-generated method stub
	
}
}